<?php

namespace app\admin\controller;
use think\Db;
use think\Controller;
use think\Request;

class Jiedian extends Login
{
    public function index()
    {	
       
    	$list = Db::table('hc_jiedian')->field(['cid', 'jiedian'])->order(['cid' => 'ASC'])->select();
    	// // var_dump($list);die;
        return view('admin@jiedian/index', [
            'title' => '节点列表',
            'list' => $list
        ]);

    }

    public function addjiedian()
    {
            // var_dump('6666');
        return view('addjiedian', [
            'title' => '添加节点',
           
        ]);
    }

     public function   doaddjiedian(Request $request)
    {   
        // var_dump($request);
      $p = $request->post();
         // 手动处理
        $data = [
            'jiedian' => $p['jiedian'],
            'cont' => $p['cont'],
            'func' => $p['func'],
            
        ];
          $result = Db::table('hc_jiedian')->data($data)->insert();

          if ($result > 0) {
            return $this->success('安排上了~', url('/admin/jiedian'));
        } else {
            return $this->error('还未安排上,请换个姿势');
        }
       // var_dump('这里已经到了添加准备SQL方法的一步了');
    }



  
}
